﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;

namespace Web.group
{
    public partial class shareout : PageBase
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            SetDivePage(ref GridView1, ref GV);
            if (!IsPostBack)
            {
                QueryData();
            }
        }

        public override void QueryData()
        {
            Hashtable user = PhoneBook.Users.Users.get(Commons.StrUtil.FormatValue(Session["userid"]));
            DataSet ds = PhoneBook.Group.PbShare.queryphonebook(Commons.StrUtil.FormatValue(user["groupid"]));
            //绑定数据集
            GVDataBind(ref GridView1, ref GV, ds);
        }

        public void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            switch (e.CommandName)
            {
                case "del":
                    string phonebookid = e.CommandArgument.ToString();
                    Hashtable phonebook = PhoneBook.Group.PhoneBook.get(phonebookid);
                    AddLog("取消了通讯录({0})的对外共享", phonebook["phonebookname"]);
                    PhoneBook.Group.PbShare.cancel(phonebookid);
                    Helper.ShowMessage(u_message, controls.UCMessageType.success, "删除成功");
                    QueryData();
                    break;
                default:
                    break;
            }
        }
    }
}